package shared;

import java.io.Serializable;
import java.util.List;

import deck.Card;

public class PlayerState implements Serializable{
	private List<Card> hand;
	private List<Card> ownedCards;
	private int bid;
	private int score;
	private String name;
	private PlayerPosition playerPosition;
	private Card playedCard;
	private boolean isRobotPlayer = false;
	
	public PlayerState(List<Card> hand, int bid, int score, String name,
			PlayerPosition playerPosition, List<Card> ownedCards) {
		super();
		this.hand = hand;
		this.bid = bid;
		this.score = score;
		this.name = name;
		this.playerPosition = playerPosition;
		this.setOwnedCards(ownedCards);
		
		// for testing
		if (name.contains("BOT")) {
			isRobotPlayer = true;
		}
	}
	
	public List<Card> getHand() {
		return hand;
	}
	public void setHand(List<Card> hand) {
		this.hand = hand;
	}
	public void clearHand() {
		hand.clear();
	}
	public void addToHand(List<Card> cards) {
		hand.addAll(cards);
	}
	public int getBid() {
		return bid;
	}
	public void setBid(int bid) {
		this.bid = bid;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public PlayerPosition getPlayerPosition() {
		return playerPosition;
	}
	public void setPlayerPosition(PlayerPosition playerPosition) {
		this.playerPosition = playerPosition;
	}

	public void setPlayedCard(Card playedCard) {
		this.playedCard = playedCard;
	}

	public Card getPlayedCard() {
		return playedCard;
	}

	public void setOwnedCards(List<Card> ownedCards) {
		this.ownedCards = ownedCards;
	}

	public List<Card> getOwnedCards() {
		return ownedCards;
	}
	public void clearOwnedCards() {
		ownedCards.clear();
	}
	public void addToOwnedCards(List<Card> trick) {
		ownedCards.addAll(trick);
	}
	public PlayerState copy() {
		return new PlayerState(hand, bid, score, name, playerPosition, ownedCards);
	}

	public void setRobotPlayer(boolean isRobotPlayer) {
		this.isRobotPlayer = isRobotPlayer;
	}

	public boolean isRobotPlayer() {
		return isRobotPlayer;
	}
	
}
